#ifndef STORAGE_CONFIGURATION_CENTER_HPP
#define STORAGE_CONFIGURATION_CENTER_HPP

#include "Storage/ConnectionConfigCollection.hpp"

namespace Storage
{

/// @ingroup Storage
/// @brief It provides a centralized access to application configuration.
///
/// The centralized configuration has to be set manually by the application. At this level, only model related 
///	configuration is stored in this class. However, at higher level (including the UI level), the configuration class 
///	should be extended to provide additional settings. Eventually, the main application will decide which configuration 
///	object to be set, before other initializations are performed.
/// @n
/// The centralized configuration object can be set only once.
class STORAGE_API ConfigurationCenter
{
public:
	/// @brief It provides the centralized configuration.
	///
	static ConfigurationCenter& configCenter();
	/// @brief It sets the centralized configuration.
	static void setConfigCenter( ConfigurationCenter* pNewConfigCenter);
	
private:
	static ConfigurationCenter* pConfiguration_;

public:
	/// @brief It initializes the configuration center.
	/// @param connCfgColl the collection of connection configurations.
	/// @param profilePath the path of the folder where the settings are stored.
	ConfigurationCenter( ConnectionConfigCollection& connCfgColl, const std::string& profilePath);

	/// @brief Dummy destructor.
	virtual ~ConfigurationCenter() { }

	/// @brief It gets the collection of connection configurations.
	ConnectionConfigCollection& connCfgCollection();

	/// @brief It gets the path of the folder where the settings are stored.
	const std::string& profilePath() const { return profilePath_; }

	/// @brief It gets the file name where the connections are persisted.
	const std::string& connectionsFilePath() const { return connectionsFilePath_; }

private:
	ConnectionConfigCollection& rConnCfgCollection_;
	std::string profilePath_;
	std::string connectionsFilePath_;

private:
	/// @brief Disabled assignment operator
	ConfigurationCenter& operator=( const ConfigurationCenter& );
};

} // namespace Storage

#endif // STORAGE_CONFIGURATION_CENTER_HPP
